

var AndroidJs={};

document.addEventListener( "load",  function()
{
     console.log("===ready===");
     var _BARCODE = 'com.westvalley.caojil.tools.JSAndroidInterface';
//		B = WebActivity;
     var JSAndroidInterface =
          {
               alertToast : function (Argus1)
               {
                    // eval("var theJsonValue = "+Argus1);
                    return WebActivity.excuteSync(_BARCODE, "alertToast", [Argus1]);
               },
               setLocalPreferences : function (Argus1,Argus2,Argus3)
               {
                    // eval("var theJsonValue = "+Argus1);
                    return WebActivity.excuteSync(_BARCODE, "setLocalPreferences", [Argus1,Argus2,Argus3]);
               }
          };
     AndroidJs.JSAndroidInterface = JSAndroidInterface;

     var classPath = 'com.westvalley.caojil.citysafedefender.constant.AuthorityState';
     //		B = WebActivity;
     var AuthorityState =
          {
               getAuthorityState : function ()
               {
                    // eval("var theJsonValue = "+Argus1);
                    return WebActivity.excuteSync(classPath, "getAuthorityState", []);
               }
          };
     AndroidJs.AuthorityState = AuthorityState;
     console.log("===ready==="+AndroidJs);
}, true );




var AnroidWebActivity = {
     //返回上一页，若没有上一页则退出
     goBack: function () {
          WebActivity.goBack();
     },
     scanbarcode: function (callback) {
          WebActivity.scanBarCode(callback.name || callback.toString().match(/function\s*([^(]*)\(/)[1]);
     },
     getToken:function(){
          return WebActivity.getToken();
     },
     //跳转到main首页
     toActivity:function(packageName,activityName){
          WebActivity.toActivity(packageName,activityName);
     },
     //获取账号 token
     getAuthorityState:function(){
          return WebActivity.getAuthorityInfo();
     },
     setPrefer:function (phone){
          AndroidJs.JSAndroidInterface.setLocalPreferences("config","visitor","1");
          AndroidJs.JSAndroidInterface.setLocalPreferences("config","phone_number",phone)
     },
     finish:function(){
          WebActivity.finish();
     }
};


var RSAUtils = {
     encryptByPublicKey:function(modulus,public_exponent,original){
          return RSAClientUtils.encryptByPublicKey(modulus,public_exponent,original);
     }
};





